package com.zhoujie.roomdemo.db;

import androidx.room.Database;
import androidx.room.Room;
import androidx.room.RoomDatabase;

import com.zhoujie.roomdemo.MyApplication;

@Database(entities = {User.class}, version = 1, exportSchema = false)
public abstract class AppDatabase extends RoomDatabase {
    public abstract UserDao mUserDao();

    private static AppDatabase instance;

    public static AppDatabase getDatabase() {
        if (instance == null) {
            instance = Room.databaseBuilder(MyApplication.getAppContext(), AppDatabase.class,
                    "room_demo").build();
        }
        return instance;
    }
}
